using UnityEngine;

public class MarketMiniProductInfo : MonoBehaviour
{
	public MarketGunMiniInfoPanel gunMiniInfoPanel;

	public MarketCarMiniInfoPanel carMiniInfoPanel;

	public MarketArmorMiniInfoPanel armorMiniInfoPanel;

	public MarketComsumableMiniInfoPanel comsumableMiniInfoPanel;

	public MarketSkinMiniInfoPanel skinMiniInfoPanel;

	public MarketWearableMiniInfoPanel wearableMiniInfoPanel;

	public MarketComsumableTextMiniInfoPanel comsumableTextMiniInfoPanel;

	public MarketTitanMiniInfoPanel titanMiniInfoPanel;

	private Product _product;

	public Product Product
	{
		get
		{
			if (_product != null)
			{
				return _product;
			}
			return MarketControllerUI.instance.selectedProduct;
		}
		set
		{
			_product = value;
		}
	}

	public void ShowMiniInfoPanel()
	{
		HideMiniInfoPanels();
		Product product = Product;
		if (product == null)
		{
			return;
		}
		switch (product.GetType().ToString())
		{
		case "ProductWeapon":
			gunMiniInfoPanel.gameObject.SetActive(true);
			gunMiniInfoPanel.SetInfo(product);
			break;
		case "ProductComsumable":
			comsumableMiniInfoPanel.gameObject.SetActive(true);
			comsumableMiniInfoPanel.SetInfo(product);
			break;
		case "ProductArmor":
			armorMiniInfoPanel.gameObject.SetActive(true);
			armorMiniInfoPanel.SetInfo(product);
			break;
		case "ProductTitan":
			titanMiniInfoPanel.gameObject.SetActive(true);
			titanMiniInfoPanel.SetInfo(product);
			break;
		case "ProductSkin":
			skinMiniInfoPanel.gameObject.SetActive(true);
			skinMiniInfoPanel.SetInfo(product);
			break;
		case "ProductCar":
		case "ProductTank":
			carMiniInfoPanel.gameObject.SetActive(true);
			carMiniInfoPanel.SetInfo(product);
			break;
		case "ProductVehicleUpgrade":
			if (MarketControllerUI.instance.selectedCategory == "Best")
			{
				if ((product as ProductVehicleUpgrade).targetId.ToLower().Contains("titanic"))
				{
					titanMiniInfoPanel.gameObject.SetActive(true);
					titanMiniInfoPanel.SetInfo(product as ProductVehicleUpgrade);
				}
				else
				{
					carMiniInfoPanel.gameObject.SetActive(true);
					carMiniInfoPanel.SetInfo(product as ProductVehicleUpgrade);
				}
			}
			else if (MarketControllerUI.instance.selectedSubcategory != "Titans")
			{
				carMiniInfoPanel.gameObject.SetActive(true);
				carMiniInfoPanel.SetInfo(product as ProductVehicleUpgrade);
			}
			else
			{
				titanMiniInfoPanel.gameObject.SetActive(true);
				titanMiniInfoPanel.SetInfo(product as ProductVehicleUpgrade);
			}
			break;
		case "ProductVehicleSkin":
			if (MarketControllerUI.instance.selectedCategory == "Best")
			{
				if ((product as ProductVehicleSkin).targetId.ToLower().Contains("titanic"))
				{
					titanMiniInfoPanel.gameObject.SetActive(true);
					titanMiniInfoPanel.SetInfo(titanMiniInfoPanel.currentProduct);
				}
				else
				{
					carMiniInfoPanel.gameObject.SetActive(true);
					carMiniInfoPanel.SetInfo(carMiniInfoPanel.currentProduct);
				}
			}
			else if (MarketControllerUI.instance.selectedSubcategory != "Titans")
			{
				carMiniInfoPanel.gameObject.SetActive(true);
				carMiniInfoPanel.SetInfo(carMiniInfoPanel.currentProduct);
			}
			else
			{
				titanMiniInfoPanel.gameObject.SetActive(true);
				titanMiniInfoPanel.SetInfo(titanMiniInfoPanel.currentProduct);
			}
			break;
		case "ProductBoot":
			wearableMiniInfoPanel.gameObject.SetActive(true);
			wearableMiniInfoPanel.SetInfo(product);
			break;
		case "ProductHat":
			wearableMiniInfoPanel.gameObject.SetActive(true);
			wearableMiniInfoPanel.SetInfo(product);
			break;
		case "ProductBoost":
			comsumableTextMiniInfoPanel.gameObject.SetActive(true);
			comsumableTextMiniInfoPanel.SetInfo(product);
			break;
		}
	}

	public void HideMiniInfoPanels()
	{
		if ((bool)gunMiniInfoPanel)
		{
			gunMiniInfoPanel.gameObject.SetActive(false);
		}
		if ((bool)carMiniInfoPanel)
		{
			carMiniInfoPanel.gameObject.SetActive(false);
		}
		if ((bool)armorMiniInfoPanel)
		{
			armorMiniInfoPanel.gameObject.SetActive(false);
		}
		if ((bool)comsumableMiniInfoPanel)
		{
			comsumableMiniInfoPanel.gameObject.SetActive(false);
		}
		if ((bool)skinMiniInfoPanel)
		{
			skinMiniInfoPanel.gameObject.SetActive(false);
		}
		if ((bool)wearableMiniInfoPanel)
		{
			wearableMiniInfoPanel.gameObject.SetActive(false);
		}
		if ((bool)comsumableTextMiniInfoPanel)
		{
			comsumableTextMiniInfoPanel.gameObject.SetActive(false);
		}
		if ((bool)titanMiniInfoPanel)
		{
			titanMiniInfoPanel.gameObject.SetActive(false);
		}
	}
}
